package foo.bar.wiki.utils;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.CharUtils;

/**
 * @author tmjee
 * @version $Date$ $Id$
 */
public class WikiUtils {

    /**
     * Can only be alphanumeric or '_'
     * 
     * @param name
     * @return
     */
    public static boolean isValidWikiPageOrSpaceName(String name) {
        if (null == name || StringUtils.isEmpty(name))
            return false;
        char[] chars = name.toCharArray();
        for (char c : chars) {
            if ((!CharUtils.isAsciiAlphanumeric(c)) && ('_' != c)) {
                return false;
            }
        }
        return true;
    }
}
